package uabc.arduino.componentes;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JCheckBox;

import org.jfree.chart.renderer.xy.XYItemRenderer;

public class ItemRendered extends JCheckBox {
	private XYItemRenderer renderer;
	private int position;

	public ItemRendered(String label,XYItemRenderer rendered, int position) {
		super(label);
		this.renderer = rendered;
		this.position = position;
		this.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				boolean flag = renderer.getItemVisible(
						ItemRendered.this.position, 0);
				renderer.setSeriesVisible(ItemRendered.this.position,
						new Boolean(!flag));
			}
		});
		this.setSelected(true);
	}
}
